package info.brenstar.boxedin.collisions;

import info.brenstar.boxedin.core.*;
import java.util.ArrayList;

import org.newdawn.slick.*;
import org.newdawn.slick.geom.Rectangle;

public class Sector {
	
	private int id;
	private Rectangle rectangle;
	private ArrayList<Sprite> sprites;
	
	public Sector(int id, Rectangle rect) {
		this.id = id;
		sprites = new ArrayList<Sprite>();
		rectangle = rect;
	}
	
	public void debug(Graphics g) {
		g.setColor(Color.white);
		g.draw(rectangle);
		g.setColor(new Color(255,255,255,64));
		g.fill(rectangle);
		g.setColor(Color.white);
		g.drawString("" + id, rectangle.getCenterX(), rectangle.getCenterY());
	}
	
	public void add(Sprite sprite) {
		if (!sprites.contains(sprite)) {
			sprites.add(sprite);
		}
	}
	
	public void remove(Sprite sprite) {
		sprites.remove(sprite);
	}
	
	public ArrayList<Sprite> getSprites() {
		return sprites;
	}
	
	public void setBounds(Rectangle rect) {
		this.rectangle = rectangle;
	}
	
	public Rectangle getBounds() {
		return this.rectangle;
	}
	
	public int getID() {
		return this.id;
	}
	
	@Override
	public String toString() {
		return "Sector ID: " + id + " | Sprites in sector: " + sprites.size();
	}
	
}
